package com.java.demo;

import com.java.demo.model.Article;
import org.springframework.context.annotation.Bean;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: WHY
 * Date: 2023-07-21
 * Time: 19:26
 */
@Order(20)
@Component
public class Articles {

    //要把当前返回的对象存储到IOC容器中
    @Bean(value="aaa")
    public Article article(){
        //伪代码
        Article article=new Article();
        article.setId(2);
        article.setTitle("钢铁是怎样炼成的");
        article.setContent("一个人的一生不应该这样度过,不应该因碌碌无为而......");
        return article;
    }
    @Bean("aaa")
    public Article article2(){
        //伪代码
        Article article=new Article();
        article.setId(1);
        article.setTitle("钢铁是怎样炼成的");
        article.setContent("一个人的一生不应该这样度过,不应该因碌碌无为而......");
        return article;
    }
    public void sayHi(){
        System.out.println("hi Articles");
    }
}
